<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script type="text/javascript">
    var arr = [18, 45, 333,5,6,1,5];
    var sum=0;
    for (var i = 0; i < arr.length; i++) {
        sum+=arr[i];
    }
    alert("数组的和是:"+sum);
</script>
</body>
</html>